﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcreport.Web.Admin
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string code = txtcode.Text.Trim();
                if (Session["CheckCode"] != null && code.ToLower() == Session["CheckCode"].ToString().ToLower())
                {
                    string sno = txtsno.Text.Trim();
                    string pwd = txtpwd.Text.Trim();
                    lcreport.BLL.admininfo st = new BLL.admininfo();
                    lcreport.Model.admininfo s = null;
                    s = st.Login(sno, pwd);
                    if (s != null)
                    {
                        Session["admin"] = s;
                        Response.Redirect("../tj.aspx");
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(this.GetType(), "a", "alert('用户名或密码错误！');", true);
                    }

                }
                else
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "a", "alert('验证码错误！');", true);

                }
            }
        }
    }
}